package LeetCode.剑指Offer._220531.高效制胜;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

/**
 * @Author: yqy
 * @Date: 2022/05/31/21:47
 * @Description:
 */
public class _15 {
    public static void main(String[] args) {

    }
    public List<List<Integer>> threeSum(int[] nums) {
        if (nums.length<3){
            return null;
        }
        List<List<Integer>> combination=new LinkedList<>();
        for (int i = 0; i < nums.length; i++) {
            for (int j = 0; j < nums.length; j++) {
                for (int k = 0; k < nums.length; k++) {
                    if (nums[i]+nums[j]+nums[k]==0){
                        List<Integer> list=new LinkedList<>();
                        list.add(i);
                        list.add(j);
                        list.add(k);
                        combination.add(list);
                    }
                }
            }
        }
        return combination;
    }
}
